package com.mine.dubbo.netty;

import com.mine.dubbo.netty.server.Server;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableConfigurationProperties(NettyServerConfigurationProperties.class)
@Log4j2
public class NettyServerAutoConfiguration {
    @Autowired
    private NettyServerConfigurationProperties nettyServerConfigurationProperties;

    @Bean
    public Server server() {
        log.info("开始加载netty server");
        return new Server(nettyServerConfigurationProperties.getPort());
    }
}
